//
//  DayView.m
//  WeatherMagic
//
//  Created by jimneylee on 10-12-17.
//  Copyright 2010 open source. All rights reserved.
//

#import "DayView.h"
#import "DayWeather.h"
@implementation DayView
@synthesize dateLable;
@synthesize weatherImageView;
@synthesize weatherInfoLable;		//晴天
@synthesize temperatureRangeLable;	//5~10
@synthesize windLable;	

- (id)initWithFrame:(CGRect)frame {
    if ((self = [super initWithFrame:frame])) {
        // Initialization code
    }
    return self;
}

-(void) TestInof
{
    dateLable.text = @"12/1 周三";
    weatherInfoLable.text = @"晴天";
}

- (void)setUpInfo:(NSMutableDictionary *)weatherinfo:(NSUInteger)dayIndex
{
	//self.backgroundColor = [UIColor clearColor];
	
	//dateLable.text = @"12/1 周三";
    
	if (dayIndex == 0)
    {
        dateLable.text = [weatherinfo objectForKey:@"week2"];
		weatherInfoLable.text = [weatherinfo objectForKey:@"weather2"];
        temperatureRangeLable.text = [weatherinfo objectForKey:@"temp2"];
        windLable.text = [weatherinfo objectForKey:@"wind2"];
        
        NSString *pictureName = [weatherinfo objectForKey:@"img2"];
        pictureName = [NSString stringWithFormat:@"a_%@.png", pictureName];
        [weatherImageView setImage:[UIImage imageNamed:pictureName]];
	}
	else if (dayIndex == 1)
    {
        dateLable.text = [weatherinfo objectForKey:@"week3"];
		weatherInfoLable.text = [weatherinfo objectForKey:@"weather3"];
        temperatureRangeLable.text = [weatherinfo objectForKey:@"temp3"];
        windLable.text = [weatherinfo objectForKey:@"wind3"];
        
        NSString *pictureName = [weatherinfo objectForKey:@"img3"];
        pictureName = [NSString stringWithFormat:@"a_%@.png", pictureName];
        [weatherImageView setImage:[UIImage imageNamed:pictureName]];
	}	
	else if (dayIndex == 2)
    {
        dateLable.text = [weatherinfo objectForKey:@"week4"];
		weatherInfoLable.text = [weatherinfo objectForKey:@"weather4"];
        temperatureRangeLable.text = [weatherinfo objectForKey:@"temp4"];
        windLable.text = [weatherinfo objectForKey:@"wind4"];
        
        NSString *pictureName = [weatherinfo objectForKey:@"img4"];
        pictureName = [NSString stringWithFormat:@"a_%@.png", pictureName];
        [weatherImageView setImage:[UIImage imageNamed:pictureName]];
	}
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)dealloc {
    [super dealloc];
}


@end
